- name: d8.istio.services
  rules:
  - alert: IstioIrrelevantExternalServiceFound
    expr: max by (namespace, name) (d8_istio_irrelevant_service == 1)
    for: 5m
    labels:
      severity_level: "5"
      tier: application
    annotations:
      plk_markup_format: "markdown"
      plk_protocol_version: "1"
      plk_create_group_if_not_exists__istio_irrelevant_external_services: IstioIrrelevantExternalServices,tier=~tier,prometheus=deckhouse,kubernetes=~kubernetes
      plk_grouped_by__istio_irrelevant_external_services: IstioIrrelevantExternalServices,tier=~tier,prometheus=deckhouse,kubernetes=~kubernetes
      summary: Found external service with irrelevant ports spec
      description: |
        There is service in the namespace: `{{$labels.namespace}}` with the name: `{{$labels.name}}` which has irrelevant ports spec.
        .spec.ports[] do not make any sense for services with a type `ExternalName` but
        istio renders for External Services with ports listener "0.0.0.0:port" which catch all the traffic to the port. It is a problem for services out of istio registry.

        It is recommended to get rid of ports section (`.spec.ports`). It is safe.
